<template>
	<view class="content">
		<view class="header"></view>
		<view class="menu-list">
			<view class="center-bg"></view>
			<view class="lat-weather flex justify-around padding">
				<view class="lat justify-around">
					<view class="flex">
						<view class="cuIcon-locationfill"></view>
						<view>{{config.countyName}}</view>
					</view>
					<view style="color: #7FB3C8;">{{config.titleHomePage}}</view>
				</view>
				<view class="weather-date flex justify-start">
					<view class="custom-date">
						<view style="font-size: 44rpx;color: #7FB3C8;font-weight: 700;">
							<uni-dateformat :date="time" format="hh:mm"></uni-dateformat>
						</view>
						<view style="color: #7FB3C8;font-size: 20rpx;">
							<uni-dateformat :date="time" format="MM月dd日"></uni-dateformat>
						</view>
					</view>
					<view class="weather">
						<iframe width="100" height="100" src="https://i.tianqi.com/?c=code&amp;a=getcode&amp;id=31&amp;icon=1" frameborder="0"></iframe>
					</view>
				</view>
			</view>
			<view class="menu-items">
				<view class="item-col-1">
					<view class="menu-item" @click="toPage('/pages/fire/fire')">
						<image src="@/static/images/fire.png"></image>
						<text class="menu-text">火灾案例</text>
					</view>
				</view>
				<view class="item-col-2">
					<view class="menu-item" @click="toPage('/pages/information/information')">
						<image src="@/static/images/information.png"></image>
						<text class="menu-text">信息点分布</text>
					</view>
					<view class="menu-item" @click="toPage('/pages/annihilator/annihilator')">
						<image src="@/static/images/annihilator.png"></image>
						<text class="menu-text">消防标识识别</text>
					</view>
				</view>
				<view class="item-col-3" @click="toPage('/pages/welfare/welfare')">
					<view class="menu-item">
						<image src="@/static/images/welfare.png"></image>
						<text class="menu-text">公益宣传片</text>
					</view>
				</view>
				<view class="item-col-4">
					<view class="menu-item" @click="toPage('/pages/red-halt/red-halt')">
						<image src="@/static/images/red-halt.png"></image>
						<text class="menu-text">消防宣教员</text>
					</view>
					<view class="menu-item" @click="toPage('/pages/hydrant/hydrant')">
						<image src="@/static/images/hydrant.png"></image>
						<text class="menu-text">固定消防设施</text>
					</view>
				</view>
				<view class="item-col-5">
					<view class="menu-item" @click="toPage('/pages/game/game')">
						<image src="@/static/images/game.png"></image>
						<text class="menu-text">消防体验游戏</text>
					</view>
				</view>
			</view>
		</view>
		<view class="help">
			<image src="../../static/images/help.png.png"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				time: Date.now(),
				address: '',
				config:''
			}
		},
		onLoad() {
			this.getTime() 
			this.config = uni.getStorageSync("fire-config")
		},
		methods: {
			getTime() {
				setInterval(() => {
					this.time = Date.now()
				}, 1000)
			},
			toPage(path) {
				console.log(path)
				uni.navigateTo({
					url: path
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		height: 100vh;
		width: 100%;

		.header {
			height: 15vh;
			background-color: #334a52;
			background-image: url("../../static/images/01.jpg.png");
			background-repeat: no-repeat;
			background-size: 100% 100%;
			background-position: center bottom;
		}
		
		.help {
			position: fixed;
			bottom: 100rpx;
			right: 100rpx;
			image {
				height: 150rpx;
				width: 150rpx;
			}
		}

		.menu-list {
			height: 85vh;
			background-image: url("@/static/images/index-bg.jpg.png");
			background-repeat: no-repeat;
			background-position: center bottom;
			background-size: 100% 100%;
			position: relative;
			.center-bg {
				height: 100%;
				width: 100%;
				background: url("@/static/images/center.png.png");
				background-repeat: no-repeat;
				background-position: center center;
				background-size: cover;
				position: absolute;
			}
			.menu-items {
				height: 45vh;
				display: flex;
				flex-direction: column;
				align-items: center;
				position: relative;
				top: 35%;
				transform: translateY(-50%);
				// background: url("@/static/images/center.png.png");
				// background-repeat: no-repeat;
				// background-position: center center;
				// background-size: cover;

				.menu-item {
					display: flex;
					flex-direction: column;
					align-items: center;
					text-align: center;
					color: #7FB3C8;
					font-size: 14rpx;

					image {
						width: 100rpx;
						height: 100rpx;
					}
				}

				.item-col-1 {
					// padding-bottom: 10rpx;
					z-index: 99;
					margin-bottom: 10rpx;
				}

				.item-col-2 {
					display: flex;
					flex-direction: row;
					position: absolute;
					top: 50rpx;

					.menu-item:first-child {
						margin-right: 220rpx;
					}
				}

				.item-col-3 {
					z-index: 99;
					image {
						width: 200rpx;
						height: 200rpx;
					}

					.menu-text {
						position: relative;
						top: -55rpx;
						color: #344A53;
						font-size: 18rpx;
					}
				}

				.item-col-4 {
					display: flex;
					flex-direction: row;
					position: absolute;
					top: 220rpx;

					.menu-item:first-child {
						margin-right: 220rpx;
					}
				}

				.item-col-5 {
					position: absolute;
					top: 350rpx;
				}
			}

			.weather-date {
				.custom-date {
					height: 80rpx;
					margin-right: 10rpx;
					padding-right: 10rpx;
					border-right: 2px solid #7FB3C8;
				}
			}

		}
	}
</style>
